\documentclass[a4paper]{article}


\usepackage{hyperref}

\usepackage[margin=1.5cm]{geometry}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{code} = [rectangle, minimum height=1cm, text centered, draw=black, fill=orange!30]
\tikzstyle{opendata} = [rectangle, rounded corners, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{passdata} = [rectangle, rounded corners, minimum height=1cm, text centered, draw=black, fill=red!30]
\tikzstyle{arroww} = [thick,->,>=stealth]
\tikzstyle{arrowr} = [dashed,->,>=stealth]


\title{Data and code diagram for the replication package}
\author{Francesco Bailo}


\begin{document}

\maketitle
\date

{\footnotesize
Bailo, F., \& Vromen, A. (2016). Hybrid social and news media protest events: from \#MarchinMarch to \#BusttheBudget in Australia. Information, Communication \& Society, 1–20. \url{https://doi.org/10.1080/1369118X.2016.1252410}
}

\vskip 20pt


Each script can be run independently from the others as far as the correct path to the input dataset(s) is provided. All datasets containing information on tweets or Twitter users (either than the id) are password protected in compliance with \textit{\hyperref[Developer Agreement and Policy]{https://dev.twitter.com/overview/terms/agreement-and-policy}} (consulted November 2016). 

\vskip 20pt

\begin{tikzpicture}[node distance=1.2cm]

\node(datap) [passdata] {Password protected dataset};

\node(datao) [opendata, below of=datap] {Open access dataset};

\end{tikzpicture}

\vskip 20pt

\begin{tikzpicture}[node distance=2cm]

\node(data0) [passdata, fill=white, minimum width=3 cm] {data};

\node(code0) [code, fill=white, minimum width=3 cm, right of=data0, xshift=9cm] {code};

\node(data1) [passdata, below of=data0] {\texttt{factiva\_marchaus.xml}};

\node(data2) [passdata, below of=data1] {\texttt{guardian\_marchaus.xml}};

\node(data3) [passdata, below of=data2] {\texttt{factiva\_bustbudget.xml}};

\node(data4) [passdata, below of=data3] {\texttt{guardian\_bustbudget.xml}};

\node(code1) [code, right of=data4, xshift=9cm] {\texttt{01\_load\_and\_prepare\_factiva\_data.R}};

\node(data5) [opendata, below of=data4] {\texttt{newspaper\_articles\_df.RData}};

\node(code2) [code, below of=code1] {\texttt{02\_plot\_figure\_3.R}};

\node(code3) [code, below of=code2] {\texttt{03\_parse\_twitter\_public\_lists.py}};

\node(data6) [opendata, below of=data5] {\texttt{twitter\_lists.sqlite}};

\node(code4) [code, below of=code3] {\texttt{04\_load\_and\_prepare\_twitter\_public\_list\_data.R}};

\node(data6bis) [opendata, below of=data6] {\texttt{twitter\_public\_lists.RData}};

% Arrows

\draw [arrowr] (data1) -> (code1);
\draw [arrowr] (data2) -> (code1);
\draw [arrowr] (data3) -> (code1);
\draw [arrowr] (data4) -> (code1);
\draw [arroww] (code1) -> (data5);
\draw [arrowr] (data5) -> (code2);
\draw [arroww] (code3) -> (data6);
\draw [arrowr] (data6) -> (code4);
\draw [arroww] (code4) -> (data6bis);

\end{tikzpicture}

\begin{tikzpicture}[node distance=2cm]

\node(data0) [passdata, fill=white, minimum width=3 cm] {data};

\node(code0) [code, fill=white, minimum width=3 cm, right of=data0, xshift=7cm] {code};

\node(data7) [passdata, below of=data0] {\texttt{twitter\_stream\_data\_2014.RData}};

\node(code5) [code, below of=code0] {\texttt{05\_load\_and\_prepare\_twitter\_stream\_data\_2014.R}};

\node(data8) [passdata, below of=data7] {\texttt{twitter\_stream\_data\_cleaned.RData}};

\node(data9) [passdata, below of=data8] {\texttt{twitter\_stream\_data\_2015a.sqlite}};

\node(data10) [passdata, below of=data9] {\texttt{twitter\_stream\_data\_2015b.sqlite}};

\node(code6) [code, below of=code5] {\texttt{06\_load\_and\_prepare\_twitter\_stream\_data\_2015.R}};

\node(code7) [code, below of=code6] {\texttt{07\_create\_twitter\_friendlist\_db.R}};

\node(data11) [opendata, below of=data10] {\texttt{twitter\_user\_friendlists.sqlite}};

\node(code8) [code, below of=code7] {\texttt{08\_parse\_friendlist.py}};

\node(code9) [code, below of=code8] {\texttt{09\_anonymise\_twitter\_stream\_data.R}};

\node(data12) [opendata, below of=data11] {\texttt{twitter\_stream\_data\_cleaned\_and\_anonymised.RData}};

\node(code10) [code, below of=code9] {\texttt{10\_create\_twitter\_friend\_graphs.R}};

\node(data13) [opendata, below of=data12] {\texttt{twitter\_friend\_graphs.RData}};

\node(data14) [opendata, below of=data13] {\texttt{twitter\_friend\_graphs\_sum\_stats.RData}};

\node(code11) [code, right of=data14, xshift=7cm] {\texttt{11\_print\_table\_2.Rnw}};

\node(code12) [code, below of=code11] {\texttt{12\_create\_twitter\_rt\_at\_fship\_graphs.R}};

\node(data15) [opendata, below of=data14] {\texttt{twitter\_rt\_at\_fship\_graphs.RData}};

\node(code13) [code, below of=code12] {\texttt{13\_compute\_net\_stats\_on\_rt\_graph.R}};

\node(data16) [opendata, below of=data15] {\texttt{net\_stats\_on\_rt\_graph.RData}};

\node(code14) [code, below of=code13] {\texttt{14\_sim\_v\_remove\_on\_rt\_graph.R}};

\node(data17) [opendata, below of=data16] {\texttt{sim\_v\_remove\_on\_rt\_graph.RData}};

\node(code15) [code, below of=code14] {\texttt{15\_plot\_figure\_5.R}};


% Arrows
\draw [arrowr] (data7) -> (code5);
\draw [arroww] (code5) -> (data8);
\draw [arrowr] (data9) -> (code6);
\draw [arrowr] (data10) -> (code6);
\draw [arroww] (code6) -> (data8);
\draw [arrowr] (data8) -> (code7);
\draw [arroww] (code7) -> (data11);
\draw [arrowr, transform canvas={yshift=0.7ex}] (data11) -> (code8);
\draw [arroww, transform canvas={yshift=-0.7ex}] (code8) -> (data11);
\draw [arrowr] (data8) -> (code9);
\draw [arroww] (code9) -> (data12);
\draw [arrowr] (data11) -> (code10);
\draw [arrowr] (data12) -> (code10);
\draw [arroww] (code10) -> (data13);
\draw [arroww] (code10) -> (data14);
\draw [arrowr] (data14) -> (code11);
\draw [arrowr] (data8) -> (code12);
\draw [arrowr] (data11) -> (code12);
\draw [arroww] (code12) -> (data15);
\draw [arrowr] (data15) -> (code13);
\draw [arrowr] (data11) -> (code13);
\draw [arroww] (code13) -> (data16);
\draw [arrowr] (data15) -> (code14);
\draw [arrowr] (data11) -> (code14);
\draw [arroww] (code14) -> (data17);
\draw [arrowr] (data17) -> (code15);
\draw [arrowr] (data16) -> (code15);



\end{tikzpicture}



\begin{tikzpicture}[node distance=2cm]

\node(data0) [passdata, fill=white, minimum width=3 cm] {data};

\node(code0) [code, fill=white, minimum width=3 cm, right of=data0, xshift=7cm] {code};

\node(data8) [passdata, below of=data0] {\texttt{twitter\_stream\_data\_cleaned.RData}};

\node(data18) [opendata, below of=data8] {\texttt{twitter\_user\_activity.RData}};

\node(code16) [code, below of=code0] {\texttt{16\_twitter\_user\_activity.R}};

\node(data11) [opendata, below of=data18] {\texttt{twitter\_user\_friendlists.sqlite}};

\node(data12) [opendata, below of=data11] {\texttt{twitter\_stream\_data\_cleaned\_and\_anonymised.RData}};

\node(code17) [code, right of=data12, xshift=7cm] {\texttt{17\_twitter\_user\_labelling\_attributes.R}};

\node(data19) [opendata, below of=data12] {\texttt{twitter\_user\_labelling\_attributes.RData}};

\node(data20) [opendata, below of=data19] {\texttt{twitter\_user\_ego\_network.RData}};

\node(code18) [code, right of=data20, xshift=7cm] {\texttt{18\_twitter\_user\_ego\_network.R}};

\node(data15) [opendata, below of=data20] {\texttt{twitter\_rt\_at\_fship\_graphs.RData}};

\node(code19) [code, below of=code18] {\texttt{19\_create\_two\_friend\_subgraphs.R}};

\node(data21) [opendata, below of=data15] {\texttt{two\_friend\_subgraphs.RData}};

\node(data6bis) [opendata, below of=data21] {\texttt{twitter\_public\_lists.RData}};

\node(code20) [code, right of=data6bis, xshift=7cm] {\texttt{20\_descriptive\_stats\_and\_plot\_figure\_4\_6.R}};


% Arrows

\draw [arrowr] (data8) -> (code16);
\draw [arroww] (code16) -> (data18);

\draw [arrowr] (data11) -> (code17);
\draw [arrowr] (data12) -> (code17);
\draw [arroww] (code17) -> (data19);

\draw [arrowr] (data11) -> (code18);
\draw [arrowr] (data12) -> (code18);
\draw [arroww] (code18) -> (data20);

\draw [arrowr] (data11) -> (code19);
\draw [arrowr] (data12) -> (code19);
\draw [arroww] (code19) -> (data21);

\draw [arrowr] (data21) -> (code20);
\draw [arrowr] (data15) -> (code20);
\draw [arrowr] (data19) -> (code20);
\draw [arrowr] (data20) -> (code20);
\draw [arrowr] (data6bis) -> (code20);
\draw [arrowr] (data12) -> (code20);


\end{tikzpicture}

\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
